import os,shutil

def movefile(srcfile,dstfile):
    if not os.path.isfile(srcfile):
        print("%s not exist!"%(srcfile))
    else:
        fpath,fname=os.path.split(dstfile)    #分离文件名和路径
        if not os.path.exists(fpath):
            os.makedirs(fpath)                #创建路径
        shutil.move(srcfile,dstfile)          #移动文件
        print("move %s -> %s"%( srcfile,dstfile))

def copyfile(srcfile,dstfile):
    if not os.path.isfile(srcfile):
        print("%s not exist!"%(srcfile))
    else:
        fpath,fname=os.path.split(dstfile)    #分离文件名和路径
        if not os.path.exists(fpath):
            os.makedirs(fpath)                #创建路径
        shutil.copyfile(srcfile,dstfile)      #复制文件
        print("copy %s -> %s"%( srcfile,dstfile))

def readLines():
    urls = []
    with open("urls.txt", "r") as f:  # 打开文件
        for url in f.readlines():
            if url.startswith('#'):
                # print(url)
                pass
            else:
                urls.append(url.replace('\n',""))       
    return urls

if __name__ == "__main__":
    # srcfile='/Users/jl/Desktop/Test/树莓派.md'
    # dstfile='/Users/jl/Desktop/树莓派.md'
    # movefile(srcfile,dstfile)
    readLines()